#ifndef _Ir_h_
#define _Ir_h_

#include <stdint.h>
#include "Fifo.h"
#include "TimeUtil.h"

#define TimerPeroid     100000

#define IrTimeOutSpace  65535
#define IrCapTimeUs     (1000000 / TimerPeroid)

#define IrCmdMaxSize    240
typedef struct LevelCapVal_t {
    uint8_t isHigh;
    uint8_t resv;
    uint16_t time;
} LevelCapVal;

typedef struct IrCmdHeader_t {
    uint8_t index;
    uint8_t resv;
    int16_t len;
} IrCmdHeader;

typedef struct IrCmd_t {
    IrCmdHeader header;
    LevelCapVal levelCapVal[IrCmdMaxSize];
} IrCmd;

void IrRxTimeOutProcess(Fifo *fifo, IrCmd *irCmd, TimeType *irStartTimestamp, TimeType timeout);
extern IrCmd IrCmdRx;
extern TimeType IrRxStartTimeMs;
#endif

